package com.bootdo.system.service;

import com.bootdo.common.domain.Tree;
import com.bootdo.hjh.cache.DefaultNodeInfo;
import com.bootdo.hjh.domain.UserExt;
import com.bootdo.hjh.vo.GroupInfo;
import com.bootdo.hjh.vo.MemberRegVO;
import com.bootdo.system.domain.DeptDO;
import com.bootdo.system.domain.UserDO;
import com.bootdo.system.vo.ProfileVO;
import com.bootdo.system.vo.UserVO;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;
import java.util.Set;

@Service
public interface UserService {
	UserDO get(Long id);

	List<UserDO> list(Map<String, Object> map);

	int count(Map<String, Object> map);

	int save(UserDO user);

	int update(UserDO user);

	int remove(Long userId);

	int batchremove(Long[] userIds);

	boolean exit(Map<String, Object> params);

	Set<String> listRoles(Long userId);

	int resetPwd(UserVO userVO,UserDO userDO) throws Exception;
	int adminResetPwd(UserVO userVO) throws Exception;

	int adminResetPayPwd(UserVO userVO) throws Exception;

	int adminResetParent(UserVO userVO) throws Exception;
	Tree<DeptDO> getTree();

	/**
	 * 更新个人信息
	 * @param userDO
	 * @return
	 */
	int updatePersonal(UserDO userDO);

	/**
	 * 更新个人图片
	 * @param file 图片
	 * @param avatar_data 裁剪信息
	 * @param userId 用户ID
	 * @throws Exception
	 */
    Map<String, Object> updatePersonalImg(MultipartFile file, String avatar_data, Long userId) throws Exception;

	int saveMember(MemberRegVO memberRegVO,Long invokeUserId);

	int updateProfile(ProfileVO profileVO);

	Integer updatePayPwd(ProfileVO profileVO);

	Integer updateLoginPwd(ProfileVO profileVO);

	Integer updateMobile(String mobile,Long userId);

	Integer updateEmail(String email,Long userId);

	List<String> searchUser(String keyword,Long userId,boolean findChildren);

	List<DefaultNodeInfo> myTeamNodeList(Long userId);

	UserDO getByUsername(String username);

	/**
	 * 发送验证码
	 * @param mobile
	 * @param userId
	 * @return
	 */
	boolean sendVerification(String mobile,Long userId);

	/**
	 * 忘记密码
	 */
	boolean forgetPassword(String mobile,String vcode,String password);

	/**
	 * 第一层直推多少人
	 */
	int countFirstRecommend(Long userId);

	/**
	 * 第二层直推多少人
	 */
	int countSecondRecommend(Long userId);

	/**
	 * 保存用户扩展信息
	 * @param userId
	 * @return
	 */
	public Integer insertUserExt(Long userId);
	/**
	 * 更新代理时间
	 * @param userId
	 * @return
	 */
	public Integer updateUserExtAgent(Long userId);

	public UserDO getUserByUsername(String username);

	public List<Integer> achievement(String startDate,String endDate) throws Exception;

	public List<String> achievementDate(String startDate,String endDate) throws Exception;

	public List<String> achievementDateMonth(String startDate,String endDate) throws Exception;

	public List<UserDO> getUserDoByAgentLeel(Integer agentLevel);

	Integer saveReplenishment(Long createUserId, int amount, int type);

	/**
	 * 升级为代理
	 * @param userId
	 * @return
	 */
	Integer saveUpgrade(Long userId, String superior);

	/**
	 *  代理及以上升级触发接口
	 */
	void upgradeTrigger(Long userId);

	/**
	 *  重新计算上级绩点
	 */
	void caclSuperJd(Long userId);

	/**
	 *  重新计算自己绩点
	 */
	int caclJd(Long userId);
}
